<?php
/**
 * oscshop 电子商务系统
 *
 * ==========================================================================
 * @link      http://www.oscshop.cn/
 * @copyright Copyright (c) 2015 oscshop.cn. 
 * @license   http://www.oscshop.cn/license.html License
 * ==========================================================================
 *
 * @author    李梓钿
 *
 */
namespace Admin\Controller;

use Admin\Model\AuthRuleModel;

class AuthRuleController extends CommonController{
	public function index(){

		$model=new AuthRuleModel();

		$data=$model->show_auth_rule();
		$list =list_to_tree($data);
//		$list=json_encode($list);

		$this->assign('empty',$data['empty']);// 赋值数据集
		$this->assign('list',$data['list']);// 赋值数据集
		$this->assign('page',$data['page']);// 赋值分页输出

		$this->display();
	}

	public function add(){

		$model=new AuthRuleModel();
		if(IS_POST){

			$data=I('post.');
			$return=$model->add_auth_rule($data);
			$this->osc_alert($return);
		}
		$this->crumbs='新增';
		$this->action=U('AuthGroup/add');

		$this->display();
	}

	public function edit(){
		$model=new AuthRuleModel();
		if(IS_POST){
			$data=I('post.');
			$return=$model->edit_auth_rule($data);
			$this->osc_alert($return);
		}
		$this->crumbs='编辑';
		$this->action=U('AuthRule/edit');
		$this->data=M('AuthRule')->find(I('id'));

		$this->display();
	}

	public function delete(){

	}

	 
}
?>